import LoginView from '@/views/Login.vue'
import HomeView from '@/views/HomeView.vue'
import IndexView from '@/views/IndexView.vue'
import ScreenView from '@/views/screen/ScreenView.vue'
import UserView from '@/views/authorization/UserView.vue'
import RoleView from '@/views/authorization/RoleView.vue'
import MenuView from '@/views/authorization/MenuView.vue'
import BrandView from '@/views/commodity/BrandView.vue'
import AttrGroupView from '@/views/commodity/AttrGroupView.vue'
import CategoryView from '@/views/commodity/CategoryView.vue'
import SPUView from '@/views/commodity/spu/SPUView.vue'
import TestView from '@/views/test/TestView.vue'
import SlotView from '@/views/test/SlotView.vue'
import SpecificationView from '@/views/commodity/SpecificationView.vue'

// 项目配置的全部路由，用户实际有权限的路由要从这里面过滤
export const allRoutes = [
  // 登录路由
  {
    path: '/login',
    component: LoginView,
    name: 'LoginView',
    meta: { title: '登录', icon: 'User' },
  },
  // 首页路由
  {
    path: '/home',
    component: HomeView,
    name: 'HomeView',
    meta: { title: 'Home', icon: 'User' },
    children: [
      {
        path: '/index',
        component: IndexView,
        name: 'IndexView',
        meta: { title: '首页', icon: 'HomeFilled' },
      },
    ],
  },
  // 数据大屏
  {
    path: '/screen',
    component: ScreenView,
    name: 'ScreenView',
    meta: { title: '数据大屏', icon: 'Platform' },
  },
  // 权限管理
  {
    path: '/authorization',
    component: HomeView,
    name: '权限管理',
    meta: { title: '权限管理', icon: 'Lock' },
    children: [
      {
        path: 'user',
        component: UserView,
        name: '用户管理',
        meta: { title: '用户管理', icon: 'user' },
      },
      {
        path: 'role',
        component: RoleView,
        name: '角色管理',
        meta: { title: '角色管理', icon: 'UserFilled' },
      },
      {
        path: 'menu',
        component: MenuView,
        name: '菜单管理',
        meta: { title: '菜单管理', icon: 'Menu' },
      },
    ],
  },
  // 商品管理
  {
    path: '/commodity',
    component: HomeView,
    name: '商品管理',
    meta: { title: '商品管理', icon: 'ShoppingTrolley' },
    children: [
      {
        path: 'brand',
        component: BrandView,
        name: '品牌管理',
        meta: { title: '品牌管理', icon: 'ShoppingCart' },
      },
      {
        path: 'attrgroup',
        component: AttrGroupView,
        name: '属性分组',
        meta: { title: '属性分组', icon: 'Operation' },
      },
      {
        path: 'category',
        component: CategoryView,
        name: '分类管理',
        meta: { title: '分类管理', icon: 'Operation' },
      },
      {
        path: 'spu',
        component: SPUView,
        name: 'SPU管理',
        meta: { title: 'SPU管理', icon: 'Grid' },
      },
      {
        path: 'specification',
        component: SpecificationView,
        name: '规格参数',
        meta: { title: '规格参数', icon: 'Memo' },
      },
    ],
  },
  // 测试路由
  {
    path: '/test',
    component: TestView,
    name: 'TestView',
    meta: { title: '测试', icon: 'User' },
  },
  // 插槽路由
  {
    path: '/slot',
    component: SlotView,
    name: 'SlotView',
    meta: { title: '插槽', icon: 'User' },
  },
]

// 常量路由，未登录的用户也可以访问
export const constRoutes = [
  // 登录路由
  {
    path: '/login',
    component: LoginView,
    name: 'LoginView',
    meta: { title: '登录', icon: 'User' },
  },
  // 首页路由
  {
    path: '/home',
    component: HomeView,
    name: 'HomeView',
    meta: { title: 'Home', icon: 'User' },
    children: [
      {
        path: '/index',
        component: IndexView,
        name: 'IndexView',
        meta: { title: '首页', icon: 'HomeFilled' },
      },
    ],
  },
  // 数据大屏
  {
    path: '/screen',
    component: ScreenView,
    name: 'ScreenView',
    meta: { title: '数据大屏', icon: 'Platform', level: 1 },
  },
  // 测试路由
  {
    path: '/test',
    component: TestView,
    name: 'TestView',
    meta: { title: '测试', icon: 'User' },
  },
  // 插槽路由
  {
    path: '/slot',
    component: SlotView,
    name: 'SlotView',
    meta: { title: '插槽', icon: 'User' },
  },
]
